package com.example.x6.configurationmaintenance;

import android.app.Activity;
import android.app.DownloadManager;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.ScrollView;
import android.widget.SeekBar;
import android.widget.TextView;
import com.example.x6.configurationmaintenance.Module.LogUtil;
import com.example.x6.configurationmaintenance.Notification.NotificationUtil;
import com.example.x6.configurationmaintenance.Utils.SuCommand;

public class TestActivity extends Activity {
    private final String TAG = getClass().getSimpleName();
    private LogUtil logUtil;
    private TextView message;
    private NotificationUtil notificationUtil;
    int progress = 0;
    private ScrollView scrollView;
    private SeekBar seekBar;
    private SuCommand suCommand;

    /* access modifiers changed from: protected */
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_demsg);
        this.logUtil = new LogUtil(this);
        this.message = (TextView) findViewById(R.id.logcat);
        this.scrollView = (ScrollView) findViewById(R.id.scrollView);
        this.notificationUtil = new NotificationUtil(this);
        this.notificationUtil.showNotification(100, null);
        new Thread(new Runnable() {
            /* class com.example.x6.configurationmaintenance.TestActivity.AnonymousClass1 */

            public void run() {
                for (int i = 0; i <= 100; i++) {
                    TestActivity.this.setProgres(i);
                    try {
                        Thread.sleep(50);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void setProgres(final int i) {
        runOnUiThread(new Runnable() {
            /* class com.example.x6.configurationmaintenance.TestActivity.AnonymousClass2 */

            public void run() {
                TestActivity.this.notificationUtil.updateProgress(100, i);
            }
        });
    }

    private void downLoadApk(Context context, String url) {
        DownloadManager.Request requestApk = new DownloadManager.Request(Uri.parse(url));
        requestApk.setDestinationInExternalPublicDir(context.getPackageName() + "/myDownLoad", "ConfigurationMaintenance.apk");
        requestApk.setVisibleInDownloadsUi(true);
        requestApk.allowScanningByMediaScanner();
        requestApk.setTitle("xxx更新下载");
        requestApk.setDescription("xxx更新下载");
        ((DownloadManager) context.getSystemService("download")).enqueue(requestApk);
    }

    private void addMessage(final String string) {
        runOnUiThread(new Runnable() {
            /* class com.example.x6.configurationmaintenance.TestActivity.AnonymousClass3 */

            public void run() {
                TextView textView = TestActivity.this.message;
                textView.append(string + "\n");
                TestActivity.this.scrollView.fullScroll(130);
            }
        });
    }

    private void clearMessage() {
        runOnUiThread(new Runnable() {
            /* class com.example.x6.configurationmaintenance.TestActivity.AnonymousClass4 */

            public void run() {
                TestActivity.this.message.setText("");
            }
        });
    }
}
